# 导包
import jsonschema

# 创建待校验数据
data = {
    "success": True,
    "code": 10000,
    "message": "操作成功",
    "money": 6.66,
    "address": None,
    "data": {
        "name": "tom",
        "age": 18,
        "height": 178.6
    },
    "luckyNumber": [6, 8, 9]
}
# 创建校验规则
schema = {
    "type": "object",
    "properties": {
        "success": {"type": "boolean"},
        "code": {"type": "integer"},
        "message": {"type": "string"},
        "money": {"type": "number"},
        "address": {"type": "null"},
        "data": {"type": "object", "properties": {
            "name": {"type": "string"},
            "age": {"type": "integer"},
            "height": {"type": "number"}
        }
                 },
        "luckyNumber": {"type": "array"}
    }}
jsonschema.validate(instance=data, schema=schema)
